from Director import graph
import random
import gradio as gr
def process_input(text):
    config={
        "configurable":{
        "thread_id":random.randint(1,10000)
        }
    }
    result=graph.invoke({"messages":[text]},config)
    return result["messages"][-1].content

with gr.Blocks() as demo:
    gr.Markdown("#LangGraph Multi_agent")
    with gr.Row():
        with gr.Column():
            gr.Markdown("## 可以问路径规划，讲笑话，快来试试吧")
            inputs_text=gr.Textbox(label="问题",placeholder="请输入你的问题",value="讲一个郭德纲的笑话")
            btn_start=gr.Button("Start",variant="primary")
        with gr.Column():
            output_text=gr.Textbox(label="Output")
    btn_start.click(process_input,inputs=[inputs_text],outputs=[output_text])

demo.launch()
